/**
 * @author Ben
 */
package com.dudo;

import android.app.Activity;
import android.content.Intent;
import android.os.Bundle;
import android.view.View;
import android.view.View.OnClickListener;
import android.widget.Button;

public class Home extends Activity implements OnClickListener {
	
    /** Called when the activity is first created. */
    @Override
    public void onCreate(Bundle savedInstanceState) {
    	//start the activity from the last saved instance (if there was one)
        super.onCreate(savedInstanceState);
        
        //set the view to display (an XML from /res/layout)
        setContentView(R.layout.home_screen);
        
        /* get the buttons and set the click listeners */
        Button playButton = (Button)this.findViewById(R.id.home_play_button);
        playButton.setOnClickListener(this);
        Button aboutButton = (Button)this.findViewById(R.id.home_about_button);
        aboutButton.setOnClickListener(this);
        Button optionsButton = (Button)this.findViewById(R.id.home_options_button);
        optionsButton.setOnClickListener(this);
    }

    /** The button click listener. */
	@Override
	public void onClick(View arg0) {
		//get the id of the button
		int viewID = arg0.getId();
		
		//declare an intent (we'll decide what to initialize it with
		//in the switch statement)
		Intent intent;
		
		//go through each ID, start the appropriate activity
		switch(viewID) {
		case R.id.home_play_button:
			intent = new Intent(this,DudoGame.class);
			this.startActivity(intent);
			break;
		case R.id.home_about_button:
			intent = new Intent(this,About.class);
			this.startActivity(intent);
			break;
		case R.id.home_options_button:
			intent = new Intent(this,Options.class);
			this.startActivity(intent);
			break;
		default: break;
		}
	}
}